#include <unistd.h>
#include <stdio.h>

static void charatatime(char*);

int main(void){

	pid_t pid;
	if( (pid = fork())<0){
		printf("fork error \n");
		return 1;
	}

	if(pid ==0 ){ // child
		charatatime("output is child\n");
	}else{ // parent
		charatatime("output is parent\n");
	}
}

static void charatatime(char* str){
	char* ptr;
	int c;
	setbuf(stdout, NULL);
	for(ptr=str; (c=*ptr) !=0; ptr++)
		putc(c,stdout);
}